<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="me.linczh.bank.bean.AccountBean" %>
<%@ page import="me.linczh.bank.bean.LogBean" %>
<%@ page import="me.linczh.bank.bean.enums.AccountType" %>
<%@ page import="me.linczh.bank.bean.enums.DepositType" %>
<%@ page import="me.linczh.bank.bean.enums.ResultType" %>

<p>
	<%=request.getAttribute("contentpage") %>
</p>
<% if (request.getAttribute("result") != null) {
			ResultType result = (ResultType)request.getAttribute("result");
			if (result != ResultType.SUCCESS) {
 %>
<div class="alert alert-danger">
 <strong>操作失败</strong><br> <%=ResultType.parse(result) %> <a href="viewpage.action?page=account/query" class="alert-link">重新填写</a>
</div>
<%		} else {
				AccountBean abean = (AccountBean)request.getAttribute("accountBean");  %>
<div class="alert alert-success">
  <strong>操作成功</strong><br> 查询成功!
</div>
<div>
	<p>
	  <strong>账号</strong>&nbsp;<%=abean.getAccount() %>
	  <% switch (abean.getDeposittype()) {
	  		case CHECKING: %>
	  <span class="label label-primary">活期</span>
	  <%	break;
	  		default: %>
	  <span class="label label-success">定期</span>
	  <% } %>
	  <% switch (abean.getAccounttype()) {
	  		case PERSONAL_COMMON: %>
	  <span class="label label-info">个人普通账户</span>
	  <%	break;
	  		case PERSONAL_VIP: %>
	  <span class="label label-warning">个人VIP账户</span>
	  <%	break;
	  		default: %>
	  <span class="label label-danger">企业账户</span>
	  <% } %>
  </p>
  <p><strong>余额</strong>&nbsp;<%=abean.getBalance() %></p>
  <p><strong>开户时间</strong>&nbsp;<%=abean.getCreatetime() %></p>
</div>
<% 		if (((String)request.getAttribute("querytype")).equals("1")) {
				List<LogBean> logs = (List<LogBean>)request.getAttribute("accountLog");
 %>
<table class="table table-bordered table-condensed table-striped">
  <tr>
    <th>操作</th>
    <th>操作员ID</th>
    <th>操作员</th>
    <th>操作客户ID</th>
    <th>操作客户</th>
    <th>操作金额</th>
    <th>剩余金额</th>
    <th>操作时间</th>
  </tr>
  <% for (LogBean log : logs) { %>
  <tr>
    <td><%=log.getOperation() %></td>
    <td><%=log.getEmployee() %></td>
    <td><%=log.getEmployeename() %></td>
    <td><%=log.getIdentity() %></td>
    <td><%=log.getUsername() %></td>
    <td><%=log.getChange() %></td>
    <td><%=log.getBalance() %></td>
    <td><%=log.getTime() %></td>
  </tr>
  <% } %>
</table>

<%		}
		}
	} else { %>
<form action="account.query.action" method="POST" role="form">
	<fieldset>
		<legend>查询信息</legend>
		<div class="form-group">
	    <label for="account">账号</label>
	    <input type="text" class="form-control" id="account" name="account" placeholder="账号">
	  </div>
	  <div class="form-group">
	    <label for="identity">身份证号码</label>
	    <input type="text" class="form-control" id="identity" name="identity" placeholder="身份证号码">
	  </div>
	  <div class="form-group">
	    <label for="password">账户密码</label>
	    <input type="password" class="form-control" id="password" name="password" placeholder="账户密码">
	  </div>
	</fieldset>
	<fieldset>
		<legend>查询类型</legend>
		<p>
			<label class="radio-inline">
			  <input type="radio" name="querytype" value="0"> 查询余额
			</label>
			<label class="radio-inline">
			  <input type="radio" name="querytype" value="1"> 查询流水
			</label>
		</p>
		<div class="form-group">
	    <label for="starttime">起始日期</label>
	    <input type="date" class="form-control" id="starttime" name="starttime" placeholder="起始日期">
	  </div>
		<div class="form-group">
	    <label for="endtime">终止日期</label>
	    <input type="date" class="form-control" id="endtime" name="endtime" placeholder="终止日期">
	  </div>
	</fieldset>
	<button type="submit" class="btn btn-default">查询</button>
</form>
<% } %>